﻿using System;
using System.IO;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;

namespace AreaOracle
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var context = new Steel_DbContext())
            {
                var areas = context.Areas.ToList();
                var sw = File.CreateText($@"AreaData.txt");
                var str=    JsonConvert.SerializeObject(areas,Formatting.Indented);
                
                try
                {
                    sw.Write(str);
                }
                finally
                {
                    sw.Close();
                }
            }

            Console.ReadKey();
        }
    }
}